package Flyweight_Pattern.Network;

import java.util.*;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class Network_Factory {
    private static Network_Factory instance=new Network_Factory();
    private static Hashtable ht;

    private Network_Factory(){
        ht=new Hashtable();
        Network switch1,hub1;
        switch1=new Switch();
        ht.put("s",switch1);
        hub1=new Hub();
        ht.put("h",hub1);
    }
    public static Network_Factory getInstance(){
        return instance;
    }

    public static Network getNetwork(String string){
        return (Network)ht.get(string);
    }
}
